<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="ui" uri="http://com.am.tag" %>
<%@ include file="../common.jsp" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>My JSP 'registerList.jsp' starting page</title>
    <script type="text/javascript" src="${path}/js/public/grid.js"></script>
    <style type="text/css">
    	.linkActive{color:#ff9900;text-decoration:none;font-weight:bold;}
		.linkNoActive{color:#3399ff;}
    </style>
    <script type="text/javascript">
    
    	var currentView = "0";
    	function statusRender(value ,record,columnObj,grid,colNo,rowNo)
		{
			if(value == "1")
			{
				return "<img src='${path}/images/1.png'/>已挂号";	
			}
			if(value == "0")
			{
				return "<img src='${path}/images/6.png'/>已退号";	
			}
		}
    
    	function doPrint()
		{
			if(!isSelectOne(mygrid))
  			{
  				alert("请选择一条记录进行收费补打");
  				return;
  			}
  			else{
  				var record = mygrid.getSelectedRecords()[0];
				openDailog("view","${path}/jsp/charge/printCharge.jsp?record_id="+record.id,350,370,"收费打印",false,true,null,function(dlg){
					dlg.getIFrame().doPrint('打印...');
				});
  			}	
		}
    	
    	function doReset()
    	{
    		$("#registerName").val("");
    		$("#startDate").val("");
    		$("#endDate").val("");
    		$("#sex").val("");
    	}
    	
    	/* function doDelete(){
    	
    		if(!isSelectOne(mygrid))
  			{
  				alert("请选择一条记录进行退号");
  				return;
  			}
  			else{
  				var record = mygrid.getSelectedRecords()[0];
  				var id = record.id + "";
  				var map = {};
  				map.register_name = record.register_name;
  				map.create_user_name = record.create_user_name;
  				ajax.remoteCall("com.system.dao.RegisterDao:checkEnableBack",[id],function(reply){
  					var result = reply.getResult();
  					if(result == "0"){
  						alert("已经不是挂号状态，不可退号");
  						return ;
  					}
  					openDailog("view","${path}/jsp/register/backRegister.jsp?id="+id,500,230,"退号",false,true,map,function(dlg){
  						dlg.getIFrame().doDelete();
  					});
  				});
	    		
			}
    	} */
    	
    	/* function doChangeView(flag)
    	{
    		addCss(flag);
    		currentView = flag;
  			resetGrid(mygrid,null,{"flag":flag,"campus":"${currentUserCampus}"});
    	} */
    	
    	function doQuery()
  		{
    		if($("#startDate").val().localeCompare($("#endDate").val()) > 0)
			{
				alert("起始日期不能大于结束日期");
				return false;
			}
    		resetGrid(mygrid,"queryForm",{"flag":currentView,"campus":"${currentUserCampus}"});
  		}
    	
    	//0--今日挂号记录  1-历史挂号记录
    	var viewArray = ["0","1"];
    	
    	function addCss(id){
    		$.each( viewArray, function(n, i){
    			if(i == id){
    				$("#"+i).find("span").removeClass();
    				$("#"+i).find("span").addClass("linkActive");
    			}else {
    				$("#"+i).find("span").removeClass();
    				$("#"+i).find("span").addClass("linkNoActive");
    			}
    		});
    	}

    	$().ready(function(){
    	
    		addCss("0");
    		//doChangeView("0");
    		resetGrid(mygrid,null,{"campus":"${currentUserCampus}"});
    	});
    	
    	function selectedSingleRowWithOut(value, record , cell, row, colNO, rowNO, columnObj, grid){
    		var col=getRealColumn(cell,grid);
    		if(col){
    			columnObj=col;
    		}
    		
    		if(columnObj.isCheckColumn && !isCheckRow(row)){
    			grid.unselectAllRow();
    			return;
    		}
    		doSelectRow(value, record , cell, row, colNO, rowNO, columnObj, grid);
    	}
    	

    </script>
  </head>
  
  <body>
  	<table cellSpacing="0" cellPadding="0" style="width:100%;height:100%;" border="0">
  		<tr>
			<td class="windowTitle"><font size="2">挂号收费  &gt; 收费补打</font></td>
		</tr>
  		<tr>
  			<td style="height:35px;width:100%" class="windowHead">	
	  			<form id="queryForm">
					<table cellSpacing="0" cellPadding="0" width="100%" height="100%" border="0" >
						<tr>
							<td width="800" height="15" valign="middle">
								<span style="margin-left:0.4cm;">挂号人：</span>
								<input name="search_CONTAIN_person_name" id="registerName" type="text" class="textbox" style="width:145px;" />
								
								&nbsp;
								性别：<select name="search_EQ_sex" id="sex" style="height:15px;width:145px;">
									<option value ="">-- 请选择 --</option>
						  			<option value ="男">男</option>
						  			<option value ="女">女</option>
								</select>
								
								<ui:Button type="query" onclick="doQuery()">查询</ui:Button>
							</td>
						</tr>
						<tr>
							<td width="800" height="15" valign="middle">
								
								<span style="margin-left:4px;">挂号时间：</span>
								<ui:DateTimePicker name="search_GTE_create_time" id="startDate" dateFormat="yyyy-MM-dd HH:mm:ss" style="width:145px" />
								<span style="margin-left:12px;margin-right:10px;">&gt;&gt;</span>
								<ui:DateTimePicker name="search_LTE_create_time" id="endDate" dateFormat="yyyy-MM-dd HH:mm:ss" style="width:145px" />
								
								<!-- 
								<span style="margin-left:0.8cm;">处理人：</span>
								<input name="search_CONTAIN_create_user_name" id="userName" class="textbox" style="width:145px" />&nbsp;&nbsp;&nbsp;
								-->
								
								<ui:Button onclick="doReset()"><img src="${path}/images/menu/reset.png" />重置</ui:Button>
							</td>
						</tr>
						<tr>
							<td width="800" height="15" valign="middle">	
								&nbsp;&nbsp;
									<ui:Button onclick="doPrint()"><img src="${path}/images/common/Print.png" />&nbsp;&nbsp;打印</ui:Button>
							</td>
						</tr>
					</table>
				</form>
				<br/>
				<a style="text-decoration: none;"></a>
			</td>
		</tr>
		
		<tr>
			<td style="width:100%;height:100%;overflow:hidden"  class="windowBody">
				<div id="mess_box" style="width:100%;height:100%;overflow:hidden">
					<ui:Grid id="mygrid" onCellClicked="selectedSingleRowWithOut" 
							 autoLoad="false"
							 dataProvider="com.system.provider.ReChargeListProvider:getData" >
						
						<ui:GridField name="id" header="ID" isChecked="true" align="center" />
			    		<ui:GridField name="person_name" header="挂号人" align="center" width="16%" />
			    		<ui:GridField name="sex" header="性别" align="center" width="8%" />
			    		<ui:GridField name="user_name" header="处理人" align="center" width="20%" />
			    		<ui:GridField name="receivable_total" header="收费金额" align="center" width="20%" />
			    		<ui:GridField name="create_time" header="挂号时间" align="center" width="36%" />
							 
		    		</ui:Grid>
		    	</div>
		    </td>
		</tr>
  	</table>
  	<script type="text/javascript">
		$().ready(function(){
			disableSelectAll(mygrid);
		});
	</script>
  </body>
</html>
